/* 人脸登录组件样式 */

/* 强制圆形样式 - 确保圆形显示 */
.face-login-video-container,
.face-guide-frame {
  border-radius: 50% !important;
  aspect-ratio: 1 / 1 !important;
}

.face-login {
  padding: 16px;
  max-width: 100%;
}

/* 摄像头错误状态 */
.face-login-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
}

.face-login-error-icon {
  font-size: 48px;
  color: #ff4d4f;
}

.face-login-error h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.face-login-error p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

/* 摄像头界面 */
.face-login-camera {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.face-login-video-container {
  position: relative;
  width: 300px;
  height: 300px;
  border-radius: 50% !important;
  overflow: hidden;
  background: #000;
  border: 4px solid #e8e8e8;
  margin: 0 auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  /* 强制圆形显示 */
  aspect-ratio: 1 / 1;
}

.face-login-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scaleX(-1); /* 镜像显示，更自然 */
}

.face-login-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* 检测状态指示器 */
.face-login-detecting {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 16px;
  border-radius: 25px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}

.face-login-detecting-icon {
  font-size: 16px;
  animation: face-login-pulse 1.5s ease-in-out infinite;
}

.face-login-detecting-text {
  font-size: 12px;
}

@keyframes face-login-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 处理中覆盖层 */
.face-login-processing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: white;
  font-size: 16px;
}

/* 人脸检测框提示 */
.face-login-face-guide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.face-guide-frame {
  position: relative;
  width: 200px;
  height: 200px;
  border: 3px solid rgba(0, 123, 255, 0.8);
  border-radius: 50% !important;
  background: rgba(0, 123, 255, 0.05);
  animation: face-guide-pulse 2s ease-in-out infinite;
  /* 强制圆形显示 */
  aspect-ratio: 1 / 1;
}

@keyframes face-guide-pulse {
  0%, 100% { 
    border-color: rgba(0, 123, 255, 0.8);
    background: rgba(0, 123, 255, 0.05);
  }
  50% { 
    border-color: rgba(0, 123, 255, 0.4);
    background: rgba(0, 123, 255, 0.1);
  }
}

/* 圆形引导框不需要四个角装饰 */

.face-guide-text {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

/* 检测结果信息 */

.face-login-tips {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  width: 100%;
  max-width: 300px;
}

.face-login-tips h4 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.face-login-tips ul {
  margin: 0;
  padding-left: 20px;
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

.face-login-tips li {
  margin-bottom: 4px;
}

/* 状态信息 */
.face-login-status {
  margin-top: 12px;
  padding: 8px;
  background: rgba(0, 123, 255, 0.1);
  border-radius: 4px;
  border-left: 3px solid #007bff;
  font-size: 12px;
  color: #666;
}

.face-login-status p {
  margin: 2px 0;
}

/* 识别结果界面 */
.face-login-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.face-login-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
}

.face-login-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: face-login-spin 1s linear infinite;
}

@keyframes face-login-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.face-login-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.face-login-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  object-fit: cover;
}

.face-login-detect-info {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #666;
  width: 100%;
  max-width: 250px;
}

.face-login-detect-info h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #333;
}

.face-login-detect-info p {
  margin: 4px 0;
}

.face-login-search-result {
  width: 100%;
  max-width: 300px;
}

.face-login-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: 8px;
  text-align: center;
}

.face-login-success-icon {
  font-size: 32px;
  color: #52c41a;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.face-login-success h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.face-login-success p {
  margin: 2px 0;
  font-size: 14px;
  color: #666;
}

.face-login-failed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: #fff2f0;
  border: 1px solid #ffccc7;
  border-radius: 8px;
  text-align: center;
}

.face-login-failed-icon {
  font-size: 32px;
  color: #ff4d4f;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.face-login-failed h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.face-login-failed p {
  margin: 2px 0;
  font-size: 14px;
  color: #666;
}

.face-login-error-tips {
  margin-top: 12px;
  padding: 8px;
  background: rgba(255, 193, 7, 0.1);
  border-radius: 4px;
  border-left: 3px solid #ffc107;
}

.error-tip {
  margin: 0;
  font-size: 12px;
  color: #856404;
  font-style: italic;
}

.face-login-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 400px;
}

.face-login-actions button {
  flex: 1;
  min-width: 120px;
  font-weight: 500;
}

/* 中等屏幕适配 */
@media (max-width: 768px) {
  .face-login-video-container {
    width: 280px;
    height: 280px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
  
  .face-guide-frame {
    width: 190px;
    height: 190px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
}

/* 移动端适配 */
@media (max-width: 480px) {
  .face-login {
    padding: 12px;
  }
  
  .face-login-video-container {
    width: 260px;
    height: 260px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
  
  .face-login-detecting {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .face-login-detecting-icon {
    font-size: 14px;
  }
  
  .face-guide-frame {
    width: 180px;
    height: 180px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
  
  .face-login-detecting-text {
    font-size: 11px;
  }
  
  .face-login-tips {
    padding: 12px;
    font-size: 13px;
  }
  
  .face-login-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }
  
  .face-login-actions button {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 375px) {
  .face-login-video-container {
    width: 240px;
    height: 240px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
  
  .face-login-detecting {
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    font-size: 12px;
  }
  
  .face-guide-frame {
    width: 160px;
    height: 160px;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1;
  }
  
  .face-login-tips {
    padding: 10px;
    font-size: 12px;
  }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  .face-login-error h3 {
    color: #ffffff;
  }
  
  .face-login-error p {
    color: #cccccc;
  }
  
  .face-login-tips {
    background: #2d2d2d;
    color: #cccccc;
  }
  
  .face-login-tips h4 {
    color: #ffffff;
  }
  
  .face-login-status {
    background: rgba(0, 123, 255, 0.2);
    color: #cccccc;
  }
  
  .face-login-detect-info {
    background: #2d2d2d;
    color: #cccccc;
  }
  
  .face-login-detect-info h4 {
    color: #ffffff;
  }
  
  .face-login-success {
    background: #1f2f1f;
    border-color: #52c41a;
  }
  
  .face-login-success h3 {
    color: #ffffff;
  }
  
  .face-login-failed {
    background: #2f1f1f;
    border-color: #ff4d4f;
  }
  
  .face-login-failed h3 {
    color: #ffffff;
  }
  
  .face-login-error-tips {
    background: rgba(255, 193, 7, 0.2);
    border-left-color: #ffc107;
  }
  
  .error-tip {
    color: #ffc107;
  }
}
